<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="/static/vue.min.js"></script>
    <script src="/static/axios.min.js"></script>
    <!-- 本地引入lib-master -->
    <link rel="stylesheet" href="/static/css/css.css">
    <link rel="stylesheet" type="text/css" href="/static/lib-master/theme-chalk/index.css" />
    <script src="/static/lib-master/index.js" type="text/javascript" charset="utf-8"></script>
</head>

<body>
    <div id="msg">
        <el-form>
            <el-form-item label="用户名" prop="username">
                <el-input style="width: 500px;" v-model="user.username" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="密码" prop="password">
                <el-input style="width: 500px;" type="password" v-model="user.password" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
                <el-button @click="resetForm('ruleForm')">重置</el-button>
            </el-form-item>
        </el-form>
    </div>
</body>
<script>
    new Vue({
        el: "#msg",
        data() {
            return {
                msg: "列表页面",
                user: {}
            }
        },
        methods: {
            submitForm() {
                axios.post("http://hgt.vaiwan.com/api/admin/users/tologin", this.user).then(({ data }) => {
                    if (data.code == 0) {
                        this.$message({
                            message: '欢迎回来,'+data.data.username,
                            type: 'success'
                        });
                        console.log(data.data.id)
                        localStorage.setItem("token",data.token)
                        localStorage.setItem("username",data.data.username)
                        localStorage.setItem("id",data.data.id)
                        window.location.href="http://hgt.vaiwan.com/api/community/tolist/tolists"
                    }
                    console.log(data)
                })
            }
        }
    })
</script>

</html>